package com.panovue.dataextraction;

import com.panovue.dataextraction.reader.*;

import java.util.ServiceLoader;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Main {
    public static String mainUrl = "https://www.proteinatlas.org/";
    public static String baseURL = "search/CD8";

//    public static void main(String[] args) {
//        Reader xmlReader = ReaderFactory.createHtmlReader();
//        String content = HttpUtil.get(mainUrl + baseURL);
//        Document document1 = xmlReader.parser(content);
//        String href = document1.getElementsByAttributeValueMatching("href", "CD8A").first().attributes().get("href");
//        String content2 = HttpUtil.get(mainUrl + href);
//        Document document2 = xmlReader.parser(content2);
//
//        System.out.println();
//    }


    private static ServiceLoader<Reader> serviceLoader = ServiceLoader.load(Reader.class);

    public static ExecutorService executorService = Executors.newCachedThreadPool();

    public static void main(String[] args) throws Exception {
//        String key = "重组Anti-CD8 alpha抗体";
//        String key = "CD8-Antibody-clone-SP16";
//        String key = "Anti-CD8A antibody produced in rabbit";
//        for (Reader reader : serviceLoader) {
//            executorService.submit(() -> {
//                reader.buildReader(key);
//            });
//        }

//        executorService.submit(() -> {
//            new ProTeiNatLasReader().buildReader("CD8A");
//        });
//        executorService.submit(() -> {
//            new CSTReader().buildReader("CD8A");
//        });
//        executorService.submit(() -> {
//            new SCBTReader().buildReader("CD8a");
//        });
//        executorService.submit(() -> {
//            new AbcamReader().buildReader("Anti-CD8 alpha");
//        });
//        executorService.submit(() -> {
//            new ThermoReader().buildReader("CD8-Antibody-clone-SP16");
//        });

    }
}
